"""A basic physics test to see how much crap can be drawn and simulated at once"""
from __future__ import division
import random, math, pygame
import os

from olpcgames import data_path
from pygame.locals import *
from sprayconstants import *

STATE_BACKGROUNDED = -1
STATE_TITLE = 0
STATE_PLAY = 1

class StopGame(Exception):
    pass

class Player(pygame.sprite.Sprite):

    group = pygame.sprite.Group()

    def __init__(self,x,y):
        super(Player,self).__init__()
        self.image = pygame.image.load('player.png')
        self.rect = self.image.get_rect()

    def update(self, delta):
        pass

def changeState(state):
    if state == STATE_TITLE:
        doNothing()
    if state == STATE_PLAY:
        # Do stuff that gets everything ready to play.
        doNothing()
    if state == STATE_BACKGROUNDED:
        doNothing()

def doNothing():
    pass
    
def main():
    pygame.init()
    
#   This is the main method
    screen = pygame.display.set_mode((1125,825))
    print os.getcwd()
    print data_path("bg.png")
#    background = pygame.image.load('./bg.png').convert()
#    screen.blit(background, (0,0))
    clock = pygame.time.Clock()

#    player = Player(50,50)
    #player = pygame.image.load('player.png').convert_alpha()

    #main game loop
    try:
	while True:
            delta = clock.tick(30)
            
            for e in pygame.event.get():
                if e.type == pygame.QUIT:
                    raise StopGame
                elif e.type == pygame.KEYDOWN:
                    if evt.key == pygame.K_ESCAPE:
                        raise StopGame

            # Update phase
#            player.update(delta)

            # Draw phase
 #           screen.blit(background, (0,0))
            #screen.blit(player, (50,50))
#            Player.group.draw(screen)
            pygame.display.flip()
    except StopGame:
        pass
# if python says run, then we should run
if __name__ == '__main__':
	main()


                          
